import {createRouter, createWebHistory} from 'vue-router'

import routes from './routes.ts'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes,
})

// 路由守卫
// router.beforeEach((to, _, next) => {
//   const token = localStorage.getItem('token')
//   if (!token && to.name !== 'login') {
//     next({ name: 'login' })
//   } else {
//     next()
//   }
// })
export default router